Skip to content

Conversation

@ascorbic
Copy link
Contributor

Description (required)

Adds info on disabling default responsive image styles. withastro/astro#13851

This has not yet been released

Related issues & labels (optional)

  • Closes #
  • Suggested label:

@netlify
Copy link

netlify bot commented May 28, 2025

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit e3f1aea
🔍 Latest deploy log https://app.netlify.com/projects/astro-docs-2/deploys/683a02313bb2240008d3b946
😎 Deploy Preview https://deploy-preview-11787--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@astrobot-houston
Copy link
Contributor

astrobot-houston commented May 28, 2025

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/reference/configuration-reference.mdx Source changed, localizations will be marked as outdated.
en/reference/experimental-flags/responsive-images.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@ascorbic ascorbic force-pushed the disable-image-styles branch from 4d98101 to 4541591 Compare May 28, 2025 13:50
@sarah11918 sarah11918 added add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) labels May 28, 2025
## Overriding image styles

The responsive image component applies a small number of styles to ensure they resize correctly. The applied styles depend on the layout type, and are designed to give the best behavior for the generated `srcset` and `sizes` attributes. These are the default styles:
The responsive image component applies a small number of styles to ensure they resize correctly. The applied styles depend on the layout type, and are designed to give the best behavior for the generated `srcset` and `sizes` attributes. You can override them with your own styles, or disable them entirely by setting [`image.experimentalDefaultStyles`](/en/reference/configuration-reference/#imageexperimentaldefaultstyles) to `false` if you prefer to handle styling them yourself.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The responsive image component applies a small number of styles to ensure they resize correctly. The applied styles depend on the layout type, and are designed to give the best behavior for the generated `srcset` and `sizes` attributes. You can override them with your own styles, or disable them entirely by setting [`image.experimentalDefaultStyles`](/en/reference/configuration-reference/#imageexperimentaldefaultstyles) to `false` if you prefer to handle styling them yourself.
The responsive image component applies a small number of styles to ensure images resize correctly. The applied styles depend on the layout type, and are designed to give the best behavior for the generated `srcset` and `sizes` attributes. You can disable them by setting [`image.experimentalDefaultStyles`](/en/reference/configuration-reference/#imageexperimentaldefaultstyles) to `false` if you prefer to handle styling them yourself.

The "override or disable" made it sound like you could access these directly to rewrite, but really, if you set this to false, they just ARE disabled, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can override them with your own styles (like any CSS) without disabling them, so it should be the default choice if someone just wants to change a single thing. It's only really Tailwind 4 that can't do it like that

Copy link
Member

@sarah11918 sarah11918 May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the sentence before could be taken ambiguously as in "by setting false, you can override or disable". ~~(Since here, we're defining what the config option does) oops, this is not the config ref part!

Let me take a shot at it so it's clear that the config option refers only to disabling entirely.

@sarah11918
Copy link
Member

OK, pushed a commit for what I think is a more logical flow to incorporate the new info. We did talk about overriding styles elsewhere, so this sets up:

  • default styles
  • override the defaults by just adding your own CSS
  • disable entirely
  • Tailwind 4
    See what you think of this, and correct as necessary!

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM! Will need to wait for the feature release, but approved for then!

@sarah11918 sarah11918 added the Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)! label May 28, 2025
@sarah11918 sarah11918 mentioned this pull request May 28, 2025
5 tasks
@ascorbic
Copy link
Contributor Author

Fixes the prop name in the original jsdoc: withastro/astro#13869

Copy link
Member

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yanthomasdev yanthomasdev merged commit 32cc618 into main May 30, 2025
10 checks passed
@yanthomasdev yanthomasdev deleted the disable-image-styles branch May 30, 2025 19:24
ArmandPhilippot added a commit to ArmandPhilippot/astro-docs that referenced this pull request Jun 2, 2025
ArmandPhilippot added a commit to ArmandPhilippot/astro-docs that referenced this pull request Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)! merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants